<% layout('/layouts/default.html', {title: '任务过程审核-任务部署秘书长审核', libs: ['validate','fileupload','dataGrid']}){ %>
<style>
	.lhTime .select2-container{
		width: 60% !important;
		margin-left: 10px;
		margin-right: 10px;
	}
	#table2 tr{
		padding-bottom: 10px;
		display: block;
	}
	.addku{
		position: absolute;
		width: 30px;
		border: 1px solid #d3d4d6;
		text-align: center;
		height: 30px;
		line-height: 30px;
		border-radius: 4px;
		margin-left: 5px;
	}

	.hideUnit{
		display: none !important;
	}

	#taskLeaderOrgDiv{
		display: none !important;
	}

	.form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control {
		background-color: #FFFFFF;
	}
	.addku1{
		width: 76%;
		height: 50px;
		line-height: 50px;
		border-radius: 5px;
		position: absolute;
		text-align: center;
		background-color: #1890ff;
		color: #eeeeee;
	}
	.addku1:hover{
		color: #eeeeee;
		cursor: pointer;
	}
	.dbd{
		padding: 10px;
		border-bottom: 1px solid gray;
		border-right: 1px solid gray;
		border-left: 1px solid gray;
		margin: auto 10px;
	}
	.dbd:nth-child(1){
		padding: 10px;
		border-bottom: 1px solid gray;
		border-top: 1px solid gray;
	}
	.xbd{
		margin-left: 10px;
	}
</style>
<div class="main-content">
	<div class="box box-main">
		<#form:form id="inputForm" model="${dcSupTaskAudit}" action="${ctx}/audit/dcSupTaskAudit/save" method="post" class="form-horizontal">
		<div class="box-body">
			<div class="form-unit">${text('任务信息')}</div>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">${text('任务年度')}：</label>
						<div class="col-sm-8">
							<#form:select path="dcSupTaskInfo.taskYear" items="${yearList}" blankOption="true" data-placeholder="请选择" itemLabel="yearLabel" itemValue="yearValue" class="form-control width-120 required"
							defaultValue="${currentYear}"/>
						</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">${text('任务类型')}：</label>
						<div class="col-sm-8">
							<#form:select path="dcSupTaskInfo.taskTypeCode" items="${dicts}" blankOption="true" data-placeholder="请选择任务类型" itemLabel="dictLabel" itemValue="dictValue" class="form-control width-120 required" />
							<#form:hidden path="dcSupTaskInfo.taskTypeName"/>
							<#form:hidden path="dcSupTaskInfo.taskStatus"/>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title="">${text('任务标题')}：</label>
						<div class="col-sm-10">
							<#form:textarea path="dcSupTaskInfo.taskTitle" rows="2" class="form-control required" autocomplete="off" placeholder="任务标题，限制200字以内" maxlength="200"/>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title="">${text('任务内容')}：</label>
						<div class="col-sm-10">
							<#form:textarea path="dcSupTaskInfo.taskContent" rows="5" placeholder="任务内容，限制1000字以内" style="white-space: pre-line;" class="form-control" maxlength="1000"/>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title="">
							<span class="required ">*</span> ${text('起止时间')}：<i
								class="fa icon-question hide"></i></label>
						<div class="col-sm-10">
							<div class="form-inline" style="padding-left: 0px !important;margin: 0px !important;">
								<#form:input path="dcSupTaskInfo.taskStartTime" readonly="true" maxlength="20" class="form-control laydate required"
								dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm" style="width:245px" placeholder="开始时间" data-done="taskTimeChange()"/>
								至
								<#form:input path="dcSupTaskInfo.taskEndTime" readonly="true" maxlength="20" class="form-control laydate required dateCheck"
								dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm" style="width:245px" placeholder="结束时间"/>
							</div>
						</div>
					</div>
				</div>
			</div>

			<div class="row">

				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title="">
							<span class="required hide">*</span> ${text('督办要求')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-10">
							<#form:textarea path="dcSupTaskInfo.taskRequireName" rows="3" class="form-control" autocomplete="off" maxlength="1000" placeholder="督办要求，限制1000字以内" />
						</div>
					</div>
				</div>

				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title="">
							<span class="required ">*</span> ${text('牵头责任单位')}：<i class="fa icon-question hide"></i></label>
						</label>
						<div class="col-sm-10">
							<#form:textarea path="dcSupTaskInfo.taskLeaderOrgBase" rows="5" class="form-control required" autocomplete="off" maxlength="1000" readonly="true" placeholder="请选择牵头责任单位" />
							<#form:treeselect   title="${text('牵头责任单位')}" allowClear='true'
							path="dcSupTaskInfo.taskLeaderOrg" labelName="taskLeaderOrgName" labelValue="${officeName!}" labelPath="dcSupTaskInfo.taskLeaderOrgName"
							url="${ctx}/sys/office/treeUnitData"
							class="hideUnit" isReturnValue="false" allowClear="true" canSelectRoot="true" canSelectParent="true"
							returnFullName="false" checkbox="true" chkboxType="{'Y':'','N':''}"
							callbackFuncName='treeselectCallback'
							placeholder="请选择牵头责任单位"/>
						</div>
					</div>
				</div>

				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('协同单位')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:treeselect  title="${text('协同单位')}"
							path="dcSupTaskInfo.taskCoopOrg" labelName="taskCoopOrgName" labelValue="${officeName!}" labelPath="dcSupTaskInfo.taskCoopOrgName"
							url="${ctx}/sys/office/treeUnitData" type="text"
							class="" isReturnValue="false" allowClear="true" canSelectRoot="true" canSelectParent="true"
							returnFullName="false" checkbox="true" chkboxType="{'Y':'','N':''}"
							placeholder="请选择协同单位"/>
						</div>
					</div>
				</div>

				<div class="col-xs-6" >
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span> 督办人：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:select path="dcSupTaskInfo.taskSupUser" items="${taskSupUser!}" blankOption="true" data-placeholder="请选择督办人" itemLabel="userName" itemValue="userCode" class="form-control width-120 "/>
							<#form:hidden path="dcSupTaskInfo.taskSupUserName"/>
						</div>
					</div>
				</div>

				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span> ${text('督办科室')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:select path="dcSupTaskInfo.taskSupOrg" dictType="dc_task_department"  blankOption="true" data-placeholder="请选择督办科室"  class="form-control width-120" />
							<#form:hidden path="dcSupTaskInfo.taskSupOrgName" />
						</div>
					</div>
				</div>

				<div class="col-xs-6" >
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> 牵头领导：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:select path="dcSupTaskInfo.taskLeader" items="${userList!}" blankOption="true" data-placeholder="请选择牵头领导" itemLabel="userName" itemValue="userCode" class="form-control width-120 " multiple="true"/>
							<#form:hidden path="dcSupTaskInfo.taskLeaderName"/>
						</div>
					</div>
				</div>

				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('联系人')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="dcSupTaskInfo.contactName" maxlength="64" value="${dcSupTaskAudit.dcSupTaskInfo.contactName}" class="form-control" placeholder="联系人"/>
						</div>
					</div>
				</div>

				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('联系电话')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="dcSupTaskInfo.contactPhone" maxlength="64" value="${dcSupTaskAudit.dcSupTaskInfo.contactPhone}" class="form-control" placeholder="联系电话"/>
						</div>
					</div>
				</div>

				<div class="col-xs-6" id="bihuan">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('排序编号')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input  path="dcSupTaskInfo.sortNum"  maxlength="10" min="1" class="form-control digits" placeholder="排序编号" />
						</div>
					</div>
				</div>

				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span>${text('反馈时间要求')}：<i
								class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:select path="dcSupTaskInfo.feedbackWay" blankOption="true" data-placeholder="请选择反馈时间要求" dictType="dc_feedback_circle_type"  onchange="feedbackCircle()" class="form-control required" defaultValue="4"/>
						</div>
					</div>
				</div>

				<div class="col-xs-6" >
					<div class="form-group" id="feedbackRateShow">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span><text id ="yearMonth"></text><i class="fa icon-question hide"></i></label>
						<div class="col-sm-8 " style="display: flex;line-height: 27px;" id="isshow">
							<#form:select path="dcSupTaskInfo.feedbackRate"  maxlength="2" class="form-control" onchange="getMutiFeedBackTimes()"/>
						</div>
					</div>
				</div>

				<div class="row multipleFeedback">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">
								<span class="required hide">*</span> </label>
							<div class="col-sm-10">
								<table id="scheBusiTaskFeedbackDataGrid"></table>
								<a href="#" id="testDataChildDataGridAddRowBtn" class="btn btn-primary btn-sm mt10 mb10"><i class="fa fa-plus"></i> 增加固定反馈时间</a>
							</div>
						</div>
					</div>
				</div>

			</div>

			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required ">*</span> ${text('督办字号')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<div style="width: 60%;float:left;">
								<#form:select path="dcSupTaskInfo.msgNum" dictType="${msgType}" onchange ="changeOne()" blankOption="false" class="form-control"/>
								<#form:hidden id="msgType" value="${msgType}"/>
							</div>
							<div style="width: 40%;float:left;padding-left: 2px;">
								<#form:input path="dcSupTaskInfo.msgNum2" maxlength="100" value="${dcSupTaskAudit.dcSupTaskInfo.messageNumber}" placeholder="督办字号"  maxlength="10" min="1" class="form-control digits required"/>
								<#form:hidden path="dcSupTaskInfo.messageNumber"/>
							</div>
						</div>
					</div>
				</div>



				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('反馈附件必填')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-6">
							<#form:radio path="dcSupTaskInfo.attachmentFlag" dictType="dc_feedback_file" class="form-control" defaultValue="0"/>
						</div>
					</div>
				</div>

			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2">
							<span class="required hide">*</span> ${text('附件上传')}：</label>
						<div class="col-sm-10">
							<#form:fileupload id="uploadFile" bizKey="${dcSupTaskAudit.dcSupTaskInfo.id}" bizType="dcSupTaskInfo_file"
							uploadType="all" class="" readonly="false" preview="true" maxUploadNum="10"/>
						</div>
					</div>
				</div>
			</div>

			<#form:hidden path="id"/>
			<#form:hidden path="targetId"/>
			<#form:hidden path="targetType"/>
			<#form:hidden path="dcSupTaskInfo.id"/>
			<#form:hidden path="dcSupTaskInfo.createBy"/>
			<div class="form-unit">${text('审核信息')}</div>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required">*</span> ${text('审核结果')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:radio path="auditResult" dictType="dc_audit_result" defaultValue="1" class="form-control required"/>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title="">
							<span class="required hide">*</span> ${text('审核意见')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-10">
							<#form:textarea path="auditOption" rows="4" style="white-space: pre-line;" class="form-control"/>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="box-footer">
			<div class="row">
				<div class="col-sm-offset-2 col-sm-10">
					<% if (hasPermi('audit:dcSupTaskAudit:edit')){ %>
					<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('提 交')}</button>&nbsp;
					<% } %>
					<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
				</div>
			</div>
		</div>
	</#form:form>
</div>
</div>
<% } %>
<!-- 0716-->
<script>
	$('.input-group-btn').eq(0).css('display','none')
	var INIT_DATA=true;
	var normalFlag =${dcSupTaskAudit.dcSupTaskInfo.normalFlag};
	if(normalFlag=='2'){
		$("#dcSupTaskInfo_taskSupUser").addClass("required")
		$("#dcSupTaskInfo_taskSupOrg").addClass("required")
	}
	// $("#dcSupTaskInfo_taskStartTime").val("${date(),'yyyy-MM-dd 00:00'}")
	laydate.render({
		elem: '#dcSupTaskInfo_taskEndTime'
		,type: 'datetime'
		,format: 'yyyy-MM-dd HH:mm'
		,done: function(value, date){
			if(value.substr(11,value.length)=='00:00'){
				$('#dcSupTaskInfo_taskEndTime').val(	value.substr(0,11)+"23:59")
			}
			taskTimeChange();
		}
	});
	//动态添加行
	//打开新的标签
	/*切换反馈方式同步切换反馈频次数据*/
	var weekData = [{ id: 1, text: '周一' }, { id: 2, text: '周二' }, { id: 3, text: '周三' }, { id: 4, text: '周四' }, { id: 5, text: '周五' }, { id: 6, text: '周六' }, { id: 7, text: '周日' }];
	var monthData = [{ id: 1, text: '1' }, { id: 2, text: '2' }, { id: 3, text: '3' }, { id: 4, text: '4' },
		{ id: 5, text: '5' }, { id: 6, text: '6' }, { id: 7, text: '7' }, { id: 8, text: '8' }, { id: 9, text: '9' },
		{ id: 10, text: '10' }, { id: 11, text: '11' }, { id: 12, text: '12' }, { id: 13, text: '13' }, { id: 14, text: '14' },
		{ id: 15, text: '15' }, { id: 16, text: '16' }, { id: 17, text: '17' }, { id: 18, text: '18' }, { id: 19, text: '19' },
		{ id: 20, text: '20' }, { id: 21, text: '21' }, { id: 22, text: '22' }, { id:23, text: '23' }, { id: 24, text: '24' },
		{ id: 25, text: '25' }, { id: 26, text: '26' }, { id: 27, text: '27' }, { id:28, text: '28' },{ id:29, text: '29' },{ id:30, text: '30' },{ id:31, text: '31' }];

	$(function (){
		feedbackCircle();
		if($('#dcSupTaskInfo_formFlag input:radio:checked').val()=='0' || $('#dcSupTaskInfo_formFlag input:radio:checked').val()== null){
			$('#levelColor').hide();
		}
	})

	$('#dcSupTaskInfo_formFlag').on('ifChecked', function(){
		if($('#dcSupTaskInfo_formFlag input:radio:checked').val()=='1') {
			$('#levelColor').show();
		}else{
			$('#levelColor').hide();
		}

	});
</script>
<script>
	//根据多次反馈，反馈频次获取后台所有反馈时间段
	var feedbackListLength =${toJson(dcSupTaskAudit.dcSupTaskInfo.dcSupTaskInfoAddList)};
	function feedbackCircle(){
		if ($("#dcSupTaskInfo_feedbackWay").val()=='4'){
			$("#feedbackRateShow").css("display","none");
			taskTimeChange();
		}
		else if($("#dcSupTaskInfo_feedbackWay").val()=='3'){
			$("#dcSupTaskInfo_feedbackRate").select2('destroy').empty();
			$("#dcSupTaskInfo_feedbackRate").select2({data: weekData,placeholder:'请选择',allowClear:true})
			$("#yearMonth").text('每周：');
			$("#feedbackRateShow").css("display","block");
		}else if($("#dcSupTaskInfo_feedbackWay").val()=='2'){
			$("#dcSupTaskInfo_feedbackRate").select2('destroy').empty();
			$("#dcSupTaskInfo_feedbackRate").select2({data: monthData,placeholder:'请选择',allowClear:true})
			$("#yearMonth").text('每月：');
			$("#feedbackRateShow").css("display","block");
		}else if($("#dcSupTaskInfo_feedbackWay").val()=='1'){
			$("#dcSupTaskInfo_feedbackRate").select2('destroy').empty();
			$("#dcSupTaskInfo_feedbackRate").select2({data: monthData,placeholder:'请选择',allowClear:true})
			$("#yearMonth").text('每季度首月：');
			$("#feedbackRateShow").css("display","block");
		}else{
			if(feedbackListLength.length==0){
				$('#scheBusiTaskFeedbackDataGrid').dataGrid('setParam', {
					data:[]
				}, true).dataGrid('reloadGrid');
			}
			$("#feedbackRateShow").css("display","none");
		}
		$("#dcSupTaskInfo_feedbackRate").val([${dcSupTaskAudit.dcSupTaskInfo.feedbackRate}]).trigger("change")
	}

	//初始化多次反馈表DataGrid对象
	$("#scheBusiTaskFeedbackDataGrid").dataGrid({
		data:${toJson(dcSupTaskAudit.dcSupTaskInfo.dcSupTaskInfoAddList)} ,
		datatype: "local", // 设置本地数据
		autoGridHeight: function(){return 'auto'}, // 设置自动高度
		// 设置数据表格列
		columnModel: [
			{header:'主键', name:'id', editable:true, hidden:true},
			{header:'${text("任务表主键")}', name:'taskId', editable:true, hidden:true},
			{header:'${text("反馈开始日期")}', name:'feedbackStartTime', width:150,
				formatter:'date', formatoptions:{srcformat:'Y-m-d H:i',newformat:'Y-m-d H:i'},
				editable:true, edittype:'text',align:"center", editoptions:{'class':'form-control laydate required', 'readonly':'true',
					dataInit: function(element){
						laydate.render({elem:element, type:'datetime', format:'yyyy-MM-dd HH:mm'});
					}
				}},
			{header:'${text("反馈结束日期")}', name:'feedbackEndTime', width:150,
				formatter:'date', formatoptions:{srcformat:'Y-m-d H:i',newformat:'Y-m-d H:i'},
				editable:true, edittype:'text', align:"center",editoptions:{'class':'form-control laydate required gridDateCheck', 'readonly':'true',
					dataInit: function(element){
						laydate.render({elem:element, type:'datetime', format:'yyyy-MM-dd HH:mm'});
					}
				}},
			{header:'${text("操作")}', name:'actions', width:80, align:'center', formatter: function(val, obj, row, act){
					var actions = [];
					if (val == 'new'){
						actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗？")}\', function(){$(\'#scheBusiTaskFeedbackDataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a>&nbsp;');
					}else{
						actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗？")}\', function(){$(\'#scheBusiTaskFeedbackDataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\',null,{display:\'none\'});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');});return false;"><i class="fa fa-trash-o"></i></a>&nbsp;');
					}
					return actions.join('');
				}, editoptions: {defaultValue: 'new'}}
		],

		// 编辑表格参数
		editGrid: true,				// 是否是编辑表格
		editGridInitRowNum: 0,		// 编辑表格的初始化新增行数
		emptyDataHint: false, 	// 表格内没有数据的时候是否提示 “无数据显示”  v4.1.7
		emptyDataHintContent: '<center>暂无数据</center>', // 没有数据的提示内容
		editGridAddRowBtn: $('#testDataChildDataGridAddRowBtn'),	// 子表增行按钮
		editGridAddRowBtnToHeader: false,	// 子表增行按钮是否显示到表头上
		editGridAddRowInitData: {id: '', status: Global.STATUS_NORMAL},	// 新增行的时候初始化的数据

		// 编辑表格的提交数据参数
		editGridInputFormListName: 'dcSupTaskInfo.dcSupTaskInfoAddList', // 提交的数据列表名
		editGridInputFormListAttrs: 'id,taskId,feedbackStartTime,feedbackEndTime', // 提交数据列表的属性字段

		// 加载成功后执行事件
		ajaxSuccess: function(data){

		}
	});

	//根据多次反馈，反馈频次获取后台所有反馈时间段
	function getMutiFeedBackTimes(){
		if($("#dcSupTaskInfo_taskStartTime").val()!=null&&$("#dcSupTaskInfo_taskStartTime").val()!=null&&$("#dcSupTaskInfo_feedbackWay").val()!=null&&$("#dcSupTaskInfo_feedbackRate").val()!=null&&feedbackListLength.length==0){
			$.post("${ctx}/taskdeploy/dcSupTaskInfo/getMutiFeedBackTimes",{taskStartTime:$("#dcSupTaskInfo_taskStartTime").val(),taskEndTime:$("#dcSupTaskInfo_taskEndTime").val(),feedbackWay:$("#dcSupTaskInfo_feedbackWay").val(),feedbackRate:$("#dcSupTaskInfo_feedbackRate").val()},function (data){
				if(data.result == Global.TRUE){
					$('#scheBusiTaskFeedbackDataGrid').dataGrid('setParam', {
						data:data.data
					}, true).dataGrid('reloadGrid');
				}else{
					js.showMessage(data.message);
				}
			});
		};
		if(feedbackListLength.length>0){
			feedbackListLength=[]
		}
	}
	$("#dcSupTaskInfo_msgNum2").val(`${dcSupTaskAudit.dcSupTaskInfo.messageNumber}`)
</script>

<script>
	function taskTimeChange(){
		if (INIT_DATA && feedbackListLength.length !=0){
			return;
		}
		let start=$("#dcSupTaskInfo_taskStartTime").val();
		let end=$("#dcSupTaskInfo_taskEndTime").val();
		let type=$("#dcSupTaskInfo_feedbackWay").val();
		if (type=='4'&&start!=''&&end != '' ){
			$("#scheBusiTaskFeedbackDataGrid").jqGrid("clearGridData");
			$('#scheBusiTaskFeedbackDataGrid').jqGrid('addRow', { position: 'last',
				addRowParams: {keys: false, focusField: true},
				initdata: {id: '',feedbackStartTime:start,feedbackEndTime:end, status: Global.STATUS_NORMAL}
			});
		}
	}
</script>


<script>
	$("#dcSupTaskInfo_taskLeaderOrgBase").click(function (){
		$("#dcSupTaskInfo_taskLeaderOrgName").click()
	})

	function treeselectCallback(id, act, index, layero, nodes){
		if (act == 'clear'){
			$("#dcSupTaskInfo_taskLeaderOrgBase").val("")
			return;
		}
		if (act=='ok'){
			let texts=""
			for (let i = 0; i <nodes.length; i++) {
				texts+=nodes[i].name+",";
			}
			if (texts.length > 0) {
				texts = texts.substr(0, texts.length - 1);
			}
			$("#dcSupTaskInfo_taskLeaderOrgBase").val(texts)
		}
	}

	function importGroup(){
		var radioHtml='';
		$.ajax({
			url: "${ctx}/task/dcSupTaskGroup/groupList",
			type: "get",
			cache: false,
			async:false,
			success: function(data){
				$.each(data,function(index,item){
					radioHtml= radioHtml+'<div class="dbd"><input type="radio" name="groupId" value="'+item.id+'"/><span class="xbd">'+item.groupName+'</span></div> '
				})

			}
		});

		layer.open({
			type: 1
			,title: ['导入常用组', 'font-size:18px; color:orange;'] //不显示标题栏
			,btn: ['确认', '取消']
			,btnAlign: 'c'
			,area: '500px;'
			,moveType: 1 //拖拽模式，0或者1
			,content: radioHtml

			,yes: function(layero){

				$.ajax({
					url: "${ctx}/task/dcSupTaskGroupUnit/radio",
					type: "post",
					cache: false,
					async:false,
					data: {
						"groupId":$("[name='groupId']").filter(":checked").val()

					},
					success: function(data){
						$("#dcSupTaskInfo_taskLeaderOrgBase").val(data.unitNames)
						$("#taskLeaderOrgBaseCode").val(data.unitCodes)
						$("#taskLeaderOrgCode").val(data.unitCodes)
						$("#dcSupTaskInfo_taskLeaderOrgName").val(data.unitNames)

					}
				});


			}
		});
	}

</script>

<script>
	jQuery.validator.addMethod("dateCheck", function(v1,v2) {
		var date1= $("#dcSupTaskInfo_taskStartTime").val();
		var startLogTimeDate = new Date(Date.parse(date1.replace(/-/g, "/"))).getTime();
		var date2=  $("#dcSupTaskInfo_taskEndTime").val();
		var endLogTimeDate = new Date(Date.parse(date2.replace(/-/g, "/"))).getTime();
		if(endLogTimeDate<=startLogTimeDate){
			return false;
		}else{
			return true;
		}
	}, "结束时间应大于开始时间");

	jQuery.validator.addMethod("gridDateCheck", function(v1,v2) {
		let prefixId= $(v2).attr("rowid")
		let statId= prefixId+"_feedbackStartTime";
		let endId= prefixId+"_feedbackEndTime";
		let date1= $("#"+statId).val();
		let startLogTimeDate = new Date(Date.parse(date1.replace(/-/g, "/"))).getTime();
		let date2=  $("#"+endId).val();
		let endLogTimeDate = new Date(Date.parse(date2.replace(/-/g, "/"))).getTime();
		if(endLogTimeDate<=startLogTimeDate){
			return false;
		}else{
			return true;
		}
	}, "结束时间应大于开始时间");

	changeOne();
	function changeOne() {
		var msgNum2=$('#dcSupTaskInfo_msgNum2').val();
		if(msgNum2.length==0){
			var msgNum = $('#dcSupTaskInfo_msgNum').val();
			msgNum = msgNum.substring(0,msgNum.indexOf('〔'))
			$.ajax({
				type: 'get',
				url: "${ctx}/taskdeploy/dcSupTaskInfo/getMaxMessageNumberByType?msgNum="+msgNum,
				success: function (res) {
					$('#dcSupTaskInfo_msgNum2').val(Number(res.data.msgNum2)+1);
				}
			})
		}else {
			$('#dcSupTaskInfo_msgNum2').val(msgNum2.substring(msgNum2.indexOf('〕')+1));
		}
	}

	$(function (){
		if("${dcSupTaskAudit.dcSupTaskInfo.normalFlag}"!=2){
			$('#bihuan').hide();
		}
	})


</script>


<script>
	$("#inputForm").validate({
		submitHandler: function(form){
			$("#dcSupTaskInfo_messageNumber").val($("#dcSupTaskInfo_msgNum").find("option:selected").text()+	$("#dcSupTaskInfo_msgNum2").val());
			$("#dcSupTaskInfo_taskSupUserName").val($("#dcSupTaskInfo_taskSupUser").find("option:selected").text());
			$("#dcSupTaskInfo_taskSupOrgName").val($("#dcSupTaskInfo_taskSupOrg").find("option:selected").text());
			const selectedValueArr = []
			if($("#dcSupTaskInfo_taskLeader").select2("data")){
				for (let i = 0; i < $("#dcSupTaskInfo_taskLeader").select2("data").length; i++) {
					// 如果该option被选中，则将它的value存入数组
					selectedValueArr.push($("#dcSupTaskInfo_taskLeader").select2("data")[i].text)
				}
			}
			// 如果后端需要字符串形式，比如逗号分隔
			const selectedValueStr = selectedValueArr.join(',')
			$("#dcSupTaskInfo_taskLeaderName").val(selectedValueStr);
			js.ajaxSubmitForm($(form), function(data){
				js.showMessage(data.message);
				if(data.result == Global.TRUE){
					js.closeCurrentTabPage(function(contentWindow){
						contentWindow.page();
					});
				}
			}, "json");
		}
	});

	$('#auditResult').on('ifChecked', function(){
		if($('#auditResult input:radio:checked').val()=='2') {
			$('#auditOption').addClass("required")
		}else{
			$('#auditOption').removeClass("required")
		}
	});
</script>